from rest_framework.serializers import ModelSerializer
from rest_framework import serializers

from houses.models import Area


class AreaSerializer(ModelSerializer):
    """城区信息序列化器"""
    aid = serializers.IntegerField(label='城区ID', read_only=True, source='id')
    aname = serializers.CharField(label='城区名', read_only=True, source='name')

    class Meta:
        model = Area
        fields = ('aname', 'aid')
